<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	
	<title>注册</title>
	<link rel="stylesheet" href="/account/statics/bootstrap3/css/bootstrap.min.css" />
	<link rel="stylesheet" href="/account/statics/bootstrap3/css/bootstrap-theme.min.css" />
	<link rel="stylesheet" href="/account/statics/css/default.css" />
	<script src="/account/statics/bootstrap3/js/jquery.min.js"></script>
	<script src="/account/statics/bootstrap3/js/bootstrap.min.js"></script>	
	<script>
		function checkInfo(form){
			var username = document.getElementById('username');
			if(username.value.length == 0){
				alert("请填写用户名");
				username.focus();
				return (false);
			}

			if(form.password.value.length == 0){
				alert('请填写密码');
				form.password.focus();
				return (false);
			}

			if(form.repasswd.value.length == 0){
				alert('请填写密码');
				form.repasswd.focus();
				return (false);
			}

			if(form.repasswd.value !== form.password.value){
				alert("请填写一样的密码");
				form.repasswd.focus();
				return (false);
			}

			if(form.code.value.length == 0){
				alert('请填写验证码');
				form.code.focus();
				return (false);
			}					
		} 
		function clean_nametip(){
			var nametip = document.getElementById('nametip');
			nametip.innerHTML = "";
		}
		function clean_pwdtip(){
			var pwdtip = document.getElementById('pwdtip');
			pwdtip.innerHTML  = "";
		}
		function clean_codetip(){
			var codetip= document.getElementById('codetip');
			codetip.innerHTML = "";
		}
	</script>
</head>
<body>
	<div class="container">
		<div class="row col-md-6 col-sm-offset-3 login">
				<form class="form-horizontal" action="{:U('Login/checkLogup','','')}" role="form" method="post" onSubmit="return checkInfo(this)" >
					<div class="form-group">
						<label for="username" class="col-sm-2 control-label">用户名:</label>
						<div class="col-sm-7">
							<input type="text" class="form-control" id="username" name="username" placeholder="用户名" onfocus="clean_nametip()"/>
							<span id="nametip">{$nametip}</span>
						</div>
					</div>

					<div class="form-group">
						<label for="password" class="col-sm-2 control-label">密 &nbsp; &nbsp;码:</label>
						<div class="col-sm-7">
							<input type="password" class="form-control" id="password" name="password" placeholder="密码" />		
						</div>				
					</div>

					<div class="form-group">
						<label for="repassword" class="col-sm-2 control-label">密 &nbsp; &nbsp;码:</label>
						<div class="col-sm-7">
							<input type="password" class="form-control" id="repasswd" name="repasswd" placeholder="再输一遍密码" onfocus="clean_pwdtip()"/>		
							<span id="pwdtip">{$pwdtip}</span>		
						</div>				
					</div>

					<div class="form-group">
						<label for="code" class="col-sm-2 control-label">验证码:</label>
						<div class="col-sm-7">
							<input type="text" class="form-control" id="code" name="code" placeholder="验证码" onfocus="clean_codetip()"/>
							<span id="codetip">{$codetip}</span>					
						</div>				
					</div>					

					<div class="form-group">
						<label for="code" class="col-sm-2 control-label"></label>
						<div class="col-sm-7">
							<img src="{:U('Login/verify','','')}" onclick="javascript:this.src=this.src+'?time='+Math.random()" />						
						</div>				
					</div>

					<div class="form-group">
						<div class="col-sm-offset-2 col-sm-7">
							<button type="submit" class="btn btn-primary btn-login" onclick="checkInfo()">注册</button>	
							<a href="{:U('Login/index')}" class="btn btn-info">登陆</a>	
						</div>
					</div>
				</form>	
		</div>
	</div>
</body>
</html>